#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
using namespace std;

int main() {
    string a, b;
    while (cin >> a >> b)
    {
        int cnt = 0;
        string tmp1 = a;
        for (int i = 0; i <= a.size(); ++i)
        {
            tmp1.insert(i, b);
            string tmp2 = tmp1;
            reverse(tmp1.begin(), tmp1.end());
            if (tmp2 == tmp1)
                ++cnt;
            tmp1 = a;
        }
        cout << cnt << endl;
    }
    return 0;
}